### Project 15 Tilting Switch Module **1.Introduction** When one side of the switch tilts below horizontal position, the switch is on; When the other side of the switch tilts below horizontal position, the switch is off. In the project, we use graphical programming to control the on and off of LED, tilting module used as a button. **2.Materials Required** 1. KEYESTUDIO UNO Control Board *1 2. V5 Sensor Shield*1 3. Piranha LED*1 4. Tilting Switch Module*1 5. Female to Female Dupont Line*6 **3.Connection Diagram** ![](media/image-20251201163828417.png) ![](media/image-20251201163848671.png) **4.Sample Code** ```c void setup() { pinMode( 3 , INPUT); pinMode( 6 , OUTPUT); } void loop() { if (( digitalRead(3) && HIGH )) { digitalWrite( 6 , HIGH ); delay( 100 ); } else { digitalWrite( 6 , LOW ); delay( 100 ); } } ``` **5.Result** After the program is downloaded, we can use tilting switch module to control LED.